﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; 
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.IO;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;


public partial class DangKi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void btnDangKi_Click(object sender, EventArgs e)
    {
        ThanhVien tv = new ThanhVien();
        tv.TenDN = txtTenDN.Text;
        tv.MK = txtMK1.Text.MD5().MD5();
        tv.Email = txtEmail.Text;
        tv.HoTen = txtHoTen.Text;
        tv.DiaChi = txtDiaChi.Text;
        tv.SDT = txtSDT.Text;
        if (txtCaptcha.Text.Equals(Session["captcha"].ToString(), StringComparison.OrdinalIgnoreCase))
        //lblMessage.Text = "Chuỗi xác nhận chính xác";
        {
            bool tontai = false;
            tontai = tv.checkUserName(txtTenDN.Text);
            if (tontai == true)
            {
                lblKtraDN.Visible = true;
            }
            else
            {
                lblKtraDN.Visible = false;
                if (tv.ThemThanhVien() == true)
                {

                    Response.Redirect("TrangChu.aspx");
                }
                 else
                    {

                        lblThongBao.Visible = true;
                        lblThongBao2.Visible = false;

                    }
              }
        }
             else
        {
            lblMessage.Text = "Vui lòng nhập đúng chuỗi xác nhận";
        }
       
    
        
    }

    
    protected void btnDangNhap_Click1(object sender, EventArgs e)
    {
        Response.Redirect("DangNhap.aspx");
    }
    





}